package homeWork0601;

public abstract class Car {
    private String leiXin;
    private int zuJin;
    private int tianShu;

    public Car(String leiXin, int zuJin) {
        this.leiXin = leiXin;
        this.zuJin = zuJin;
    }

    public Car(){}

    public String getLeiXin() {
        return leiXin;
    }

    public int getZuJin() {
        return zuJin;
    }

    public int getTianShu() {
        return tianShu;
    }

    public void setTianShu(int tianShu) {
        this.tianShu = tianShu;
    }

    private int zongJia(){
        int r=0;
        r=getZuJin()*getTianShu();
        return r;
    }
    protected abstract String xinXi();

    //模板方法
    public final String print(){
        //指的是子类中覆盖的方法
        String msg=xinXi();
        int jiaGe=zongJia();
        msg+="租金:"+jiaGe;
        return msg;
    }
}
